<template>
  <el-scrollbar style="height: 100%">
    <el-menu
      background-color="#fff"
      text-color="gray"
      active-text-color="#fb5d87"
      style="height: 100%"
    >
      <template v-for="item in asideMenu">
        <el-menu-item
          :index="item.label"
          v-if="!Object.prototype.hasOwnProperty.call(item, 'children')"
          :key="item.label"
          @click="selectMenu(item)"
        >
          <i :class="item.icon"></i><span slot="title">{{ item.label }}</span>
        </el-menu-item>
        <el-submenu
          :index="item.label"
          v-if="Object.prototype.hasOwnProperty.call(item, 'children')"
          :key="item.label"
        >
          <template slot="title">
            <i :class="item.icon"></i><span>{{ item.label }}</span>
          </template>
          <el-menu-item
            :index="subitem.label"
            v-for="subitem in item.children"
            :key="subitem.label"
            @click="selectMenu(subitem)"
          >
            <i :class="subitem.icon"></i>{{ subitem.label }}
          </el-menu-item>
        </el-submenu>
      </template>
    </el-menu>
  </el-scrollbar>
</template>

<script>
import bus from "@/store/bus.js";

export default {
  props: {},
  data() {
    return {
      asideMenu: [
        { path: "/member/Workbench", label: "工作台", icon: "el-icon-s-home" },
        {
          path: "",
          label: "市场大盘",
          icon: "el-icon-setting",
          children: [
            {
              path: "/market/IndustryOverview",
              label: "行业大盘",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "创意灵感",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/video",
              label: "热门视频",
              icon: "el-icon-setting",
            },
            {
              path: "/search/article",
              label: "热门专栏",
              icon: "el-icon-setting",
            },
            {
              path: "/search/album",
              label: "热门相簿",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/hotVideo",
              label: "爆款视频榜",
              icon: "el-icon-setting",
            },
            {
              path: "/tag/video",
              label: "行业标签榜",
              icon: "el-icon-setting",
            },
            {
              path: "/search/videoActivity",
              label: "热门活动",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "UP主查找",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/blogger",
              label: "UP主搜索",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/author",
              label: "达人排行榜",
              icon: "el-icon-setting",
            },
            {
              path: "/search/price",
              label: "商业报价查询",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "数据监控",
          icon: "el-icon-setting",
          children: [
            {
              path: "/monitor/blogger",
              label: "关注的UP主",
              icon: "el-icon-setting",
            },
            {
              path: "/monitor/video",
              label: "视频监控",
              icon: "el-icon-setting",
            },
            {
              path: "/monitor/live",
              label: "直播监控",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "品牌推广",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/brand",
              label: "品牌搜索",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/brand",
              label: "品牌排行榜",
              icon: "el-icon-setting",
            },
            {
              path: "/brand/launch",
              label: "品牌投放管理",
              icon: "el-icon-setting",
            },
            {
              path: "/brand/diagnosis",
              label: "品牌评论诊断",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "电商分析",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/goods",
              label: "商品搜索",
              icon: "el-icon-setting",
            },
            {
              path: "/search/goodsVideo",
              label: "带货视频",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/goods",
              label: "商品排行榜",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "直播分析",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/live",
              label: "直播间搜索",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/live",
              label: "人气排行榜",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/gift",
              label: "礼物排行榜",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "手游分析",
          icon: "el-icon-setting",
          children: [
            {
              path: "/search/game",
              label: "手游搜索",
              icon: "el-icon-setting",
            },
            {
              path: "/rank/game",
              label: "手游推广榜",
              icon: "el-icon-setting",
            },
          ],
        },
        {
          path: "",
          label: "我的收藏",
          icon: "el-icon-setting",
          children: [
            {
              path: "/favorite/blogger",
              label: "收藏的UP主",
              icon: "el-icon-setting",
            },
            {
              path: "/favorite/video",
              label: "收藏的素材",
              icon: "el-icon-setting",
            },
            {
              path: "/favorite/brand",
              label: "收藏的品牌",
              icon: "el-icon-setting",
            },
            {
              path: "/favorite/goods",
              label: "收藏的商品",
              icon: "el-icon-setting",
            },
          ],
        },
      ],
    };
  },
  methods: {
    selectMenu(menu) {
      console.log(menu);
      bus.$emit("selectMenu", menu);
    },
  },
};
</script>

<style lang="scss" scoped>
#asider {
  height: 100%;
  .el-menu {
    height: 100%;
    border: none;
  }
}
</style>
